# 导包
import requests

# 设置url,发送http请求和响应结果
# 方法1
# url = "http://tpshop-test.itheima.net/Home/Goods/search.html?q=iphone"
# resp = requests.get(url = url)
#
# print("响应状态码=", resp.status_code)
# print("响应结果:",resp.text)

# 方法2
url1 = "http://tpshop-test.itheima.net/Home/Goods/search.htm"
params = {"q": "iPhone"}
resp1 = requests.get(url=url1, params=params)
print("响应状态码=", resp1.status_code)
print("响应结果:", resp1.text)
